<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include/taglibs.jsp"%>

<script type="text/javascript" src="${ctx }/js/jscolor.js"></script>


 <style type="text/css" media="screen">
   .colorwell {
     border: 2px solid #fff;
     width: 6em;
     text-align: center;
     cursor: pointer;
   }
   .colorwell-selected {
     border: 2px solid #000;
     font-weight: bold;
   }
 </style>
 
 <script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
    $('#demo').hide();
    var f = $.farbtastic('#picker');
    var p = $('#picker').css('opacity', 0.25);
    var selected;
    $('.colorwell')
      .each(function () { 
    	  f.linkTo(this); $(this).css('opacity', 0.75);
      })
      .focus(function() {
        if (selected) {
          $(selected).css('opacity', 0.75).removeClass('colorwell-selected');
        }
        f.linkTo(this);
        p.css('opacity', 1);
        $(selected = this).css('opacity', 1).addClass('colorwell-selected');
        
        $("#picker").css("top",($(this).position().top-Number($("#picker").css("height").replace("px",""))));
        $("#picker").css("left",$(this).position().left);
        $("#picker").show();
      })
      .blur(function (){
    	  $("#picker").hide();  
      });
  });
  
  function saveData(type){
	  
	  if(type=="D"){//삭제
		  $("#frmSave").attr("action","./bdmg0204T.do");
	  }else{
		  if($("#brd_no").val()=="0"){//신규
			  $("#frmSave").attr("action","./bdmg0202T.do");  
		  }else{//수정
			  $("#frmSave").attr("action","./bdmg0203T.do");  
		  }
		  if($("#brd_nm").val()==''){
			  alert("게시판명을 입력하세요");
			  $("#brd_nm").focus();
			  return false;
		  }
	  }
// 	  alert($("#frmSave").attr("action"));
	  $("#frmSave").submit();
	  
  }
  
  function showFormData(){
	  
	  $("#frmSave").find("input[type='text']").each(function(){
		  if( $(this).attr("id")=="new_icon_tm"){
			  $(this).val("12");
		  }else if( $(this).attr("id")=="hot_icon_cnt"){
			  $(this).val("100");
		  }else if( $(this).attr("id").indexOf("_color")>-1){
			  $(this).val("#ffffff");
			  $(this).css("background-color",$(this).val());
		  }else{
			  $(this).val("");  
		  }
	  });
		$("#background_color").val("#000000");
		$("#background_color").css("background-color",$("#background_color").val());
	  
	  $("#frmSave").find("input[type='checkbox']").each(function(){
		  if( $(this).attr("id")=="secret_yn"){
			  $(this).attr("checked",true);
		  }else{
			  $(this).attr("checked",false);  
		  }
	  });
	  
	  $("#frmSave").find("select").each(function(){
		  
		  if( $(this).attr("id").indexOf("_font")>-1){
			  $(this).find("option:eq(2)").attr("selected",true);
		  }else{
			  $(this).find("option:eq(0)").attr("selected",true);  
		  }
	  });
	  
	  $("#brd_no").val("0");
	  $("#divFrm").show();
  }
  
  function setData(obj){
		$("#brd_no").val(obj.brd_no);
		$("#brd_type").val(obj.brd_type);
		if("Y"==obj.secret_yn){
			$("#secret_yn").attr("checked",true);	
		}else{
			$("#secret_yn").attr("checked",false);
		}
		if("Y"==obj.file_yn){
			$("#file_yn").attr("checked",true);	
		}else{
			$("#file_yn").attr("checked",false);
		}
		
		$("#background_color").val(obj.background_color);
		$("#background_color").css("background-color",$("#background_color").val());
		$("#new_icon_tm").val(obj.new_icon_tm);
		$("#hot_icon_cnt").val(obj.hot_icon_cnt);
		$("#title_color").val(obj.title_color);
		$("#title_color").css("background-color",obj.title_color);
		$("#default_color").val(obj.default_color);
		$("#default_color").css("background-color",obj.default_color);
		$("#total_color").val(obj.total_color);
		$("#total_color").css("background-color",obj.total_color);
		$("#title_font").val(obj.title_font);
		$("#defalut_font").val(obj.defalut_font);
		$("#total_font").val(obj.total_font);
		
		if("Y"==obj.title_strong_yn){
			$("#title_strong_yn").attr("checked",true);	
		}else{
			$("#title_strong_yn").attr("checked",false);
		}
		if("Y"==obj.default_strong_yn){
			$("#default_strong_yn").attr("checked",true);	
		}else{
			$("#default_strong_yn").attr("checked",false);
		}
		if("Y"==obj.title_strong_yn){
			$("#total_strong_yn").attr("checked",true);	
		}else{
			$("#total_strong_yn").attr("checked",false);
		}
		if("Y"==obj.sms_yn){
			$("#sms_yn").attr("checked",true);	
		}else{
			$("#sms_yn").attr("checked",false);
		}
		
// 		$("#title_strong_yn").val(obj.title_strong_yn);
// 		$("#default_strong_yn").val(obj.default_strong_yn);
// 		$("#total_strong_yn").val(obj.total_strong_yn);
		$("#input_color").val(obj.input_color);
		$("#input_color").css("background-color",obj.input_color);
// 		$("#sms_yn").val(obj.sms_yn);
		$("#brd_nm").val(obj.brd_nm);
// 		$("#file_yn").val(obj.file_yn);
		
		$(".brd_nm").html(obj.brd_nm);
		$(".brd_no").html(obj.brd_no);
		
		$("#divFrm").show();
  }
 </script>



<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<TR>
		<TD height="20">■ ${param.p_id } 그룹 게시판관리</TD>
		<TD align="right" height="20"><A
			href="./bdmg0101Q.do">[그룹목록]</A></TD>
	</TR>
</TABLE>
<table width="100%" border="0" cellspacing="1" cellpadding="2"
	bgcolor="#A0A0A0">
		<tr height="25" bgcolor="#DBDBDB">
			<th align="center" width="150">파트너</th>
			<th align="center" width="150">게시판아이디</th>
			<th align="center" width="*">게시판명</th>
			<th align="center" width="550">URL</th>
			<th align="center" width="200">스킨명</th>
			<th align="center" width="100">환경설정</th>
		</tr>
<c:if test="${list !=null && fn:length(list)>0 }">
	<c:forEach var="map" items="${list}" varStatus="status">
		<tr height="25" bgcolor="#FFFFFF">
			<td><div align="center">&nbsp;&nbsp; ${pension.p_nm }</div></td>
			<td><div align="center">&nbsp;&nbsp; ${map.brd_no}</div></td>
			<td><div align="left">
					&nbsp;&nbsp; 
					<A HREF="/board/bd/mg/ubdmg0101Q.do?p_id=${map.p_id }&brd_no=${map.brd_no}" target="_blank">${map.brd_nm }</a>
				</div></td>
			<td>http://www.pensiontrip.net/board/bd/mg/ubdmg0101Q.do?p_id=${map.p_id }&brd_no=${map.brd_no}</td>
			<td><div align="center">&nbsp;&nbsp;
			<c:if test="${'1'==map.brd_type }">일반게시판</c:if>
			<c:if test="${'2'==map.brd_type }">공지게시판</c:if>
			<c:if test="${'3'==map.brd_type }">사진게시판</c:if>
			<c:if test="${'4'==map.brd_type }">FAQ</c:if>
			</div></td>
			<td><div align="center">
					<A HREF="#" onclick="setData({'brd_no':'${map.brd_no}','brd_type':'${map.brd_type}','file_yn':'${map.file_yn}','secret_yn':'${map.secret_yn}','new_icon_tm':'${map.new_icon_tm}','hot_icon_cnt':'${map.hot_icon_cnt}','title_color':'${map.title_color}','default_color':'${map.default_color}','total_color':'${map.total_color}','title_font':'${map.title_font}','defalut_font':'${map.defalut_font}','total_font':'${map.total_font}','title_strong_yn':'${map.title_strong_yn}','default_strong_yn':'${map.default_strong_yn}','total_strong_yn':'${map.total_strong_yn}','input_color':'${map.input_color}','sms_yn':'${map.sms_yn}','brd_nm':'${map.brd_nm}','background_color':'${map.background_color }'});">환경설정</A>
				</div></td>
		</tr>
	</c:forEach>
</c:if>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0"
	bgcolor="#959595">
	<form name="brd_manager" method=get
		action="/module/board2/admin/index.php">
		<INPUT TYPE="hidden" name="mode" value="boards"> <INPUT
			TYPE="hidden" name="step" value="add">
		<TR>
			<TD height="25" style="text-align: right;padding-right: 20px;">
				<input type="button" onclick="showFormData();return false;" name="board_Man_submit" value="게시판생성"
				style="cursor:pointer ;BORDER-RIGHT: #333300 1px solid; BORDER-TOP: #333300 1px solid; BORDER-LEFT: #333300 1px solid; BORDER-BOTTOM: #333300 1px solid; font-size: 9pt">
			</TD>
		</TR>
	</form>
</TABLE>
<BR>

${pageHtml }
<BR>
<BR>

<div id="divFrm" style="display: none;">
<TABLE>
	<TR>
		<TD class=head> <span class="brd_nm"></span> ( <span class="brd_no"></span> ) 환경설정</TD>
	</TR>
</TABLE>

<FORM id="frmSave" name='frmSave' method='post' action='./bdmg0202T.do'>
	<input type='hidden' name='p_id' id='p_id' value='${param.p_id }'>
	<input type='hidden' name='brd_no' id='brd_no' value=''>
	<TABLE width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#707070">
		<TR>
			<TD width="150" bgcolor="#DBDBDB" class="list">&nbsp;&nbsp; 게시판명</TD>
			<TD bgcolor="#FFFFFF" class=list>&nbsp;&nbsp; <input type="text" name="brd_nm" value="" id="brd_nm"/>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" onclick="saveData('N');return false;"
				name="board_config_submit"
				value="          저             장         "
				style="BORDER-RIGHT: #333300 1px solid; BORDER-TOP: #333300 1px solid; BORDER-LEFT: #333300 1px solid; BORDER-BOTTOM: #333300 1px solid; font-size: 9pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input
				type="button" name="board_delete" value="     삭        제    "
				onclick="saveData('D');return false;"
				style="BORDER-RIGHT: #333300 1px solid; BORDER-TOP: #333300 1px solid; BORDER-LEFT: #333300 1px solid; BORDER-BOTTOM: #333300 1px solid; font-size: 9pt">
			</TD>
		</TR>
		<TR>
			<TD bgcolor="#DBDBDB" class=list>&nbsp;&nbsp; 기능</TD>
			<TD bgcolor="#FFFFFF" class=list>&nbsp;&nbsp; 
				<label>
				<input type='checkbox' name="secret_yn" id="secret_yn" value="Y" checked> 잠금글 기능 사용( 잠금글은 비밀번호를 입력하여 일치하여야 글을 보기가 가능합니다. )
				</label>
				<br>
				&nbsp;&nbsp;
				<label>
				<input type='checkbox' name="file_yn" id="file_yn" value="Y">
				파일첨부
				</label>
			</TD>
		</TR>
		<TR>
			<TD bgcolor="#DBDBDB" class=list>&nbsp;&nbsp; 스킨</TD>
			<TD bgcolor="#FFFFFF" class=list>&nbsp;&nbsp; <select
				name="brd_type" id="brd_type">
					<option value="1">일반게시판</option>
					<option value="2">공지게시판</option>
					<option value="3">사진게시판</option>
					<option value="4">FAQ</option>
					<option value="5">블로그링크</option>
			</select>

			</TD>
		</TR>
		<TR>
			<TD bgcolor="#DBDBDB" class=list>&nbsp;&nbsp; 아이콘</TD>
			<TD bgcolor="#FFFFFF" class=list>&nbsp;&nbsp; NEW <input
				type='text' name="new_icon_tm" id="new_icon_tm" value="0" size="10"> ( 등록후 해당
				시간내의 글에 New 아이콘을 붙여줍니다. )<br> &nbsp;&nbsp; HOT <input
				type='text' name="hot_icon_cnt" id="hot_icon_cnt" value="100" size="10"> ( 조회수가
				해당건 이상의 글에 Hot 아이콘을 붙여줍니다. )
			</TD>
		</TR>
		<TR>
			<TD bgcolor="#DBDBDB" class=list>&nbsp;&nbsp; 배경색</TD>
			<TD bgcolor="#FFFFFF" class=list>&nbsp;&nbsp; 색상 
				<input type='text' name="background_color"
				id="background_color" value="#000000" size="10" class="colorwell">&nbsp;&nbsp;
			</TD>
		</TR>
		<TR>
			<TD bgcolor="#DBDBDB" class=list>&nbsp;&nbsp; 타이틀</TD>
			<TD bgcolor="#FFFFFF" class=list>&nbsp;&nbsp; 폰트 <select
				name="title_font" id="title_font">
					<option value="1">바탕</option>
					<option value="2">굴림</option>
					<option value="3" selected>돋움</option>
					<option value="4">궁서</option>
			</select> &nbsp;&nbsp; 색상 
				<input type='text' name="title_color"
				id="title_color" value="#FFFFFF" size="10" class="colorwell">&nbsp;&nbsp;
				<label>
				<input type='checkbox' name="title_strong_yn" id="title_strong_yn" value="Y">두껍게
				</label>
			</TD>
		</TR>
		<TR>
			<TD bgcolor="#DBDBDB" class=list>&nbsp;&nbsp; 일반글</TD>
			<TD bgcolor="#FFFFFF" class=list>&nbsp;&nbsp; 폰트 <select
				name="defalut_font" id="defalut_font">
					<option value="1">바탕</option>
					<option value="2">굴림</option>
					<option value="3" selected>돋움</option>
					<option value="4">궁서</option>
			</select> &nbsp;&nbsp; 색상 
				<input type='text' name="default_color" id="default_color"  class="colorwell"
				value="#FFFFFF" size="10" >&nbsp;&nbsp;&nbsp;
				<label>
				<input type='checkbox' name="default_strong_yn" id="default_strong_yn" value="Y">두껍게
				</label>
			</TD>
		</TR>
		<TR>
			<TD bgcolor="#DBDBDB" class=list>&nbsp;&nbsp; 전체설정</TD>
			<TD bgcolor="#FFFFFF" class=list>&nbsp;&nbsp; 폰트 <select
				name="total_font" id="total_font">
					<option value="1">바탕</option>
					<option value="2">굴림</option>
					<option value="3" selected>돋움</option>
					<option value="4">궁서</option>
			</select> &nbsp;&nbsp; 폰트색상 
				<input type='text' name="total_color" id="total_color"  class="colorwell"
				value="#FFFFFF" size="10">&nbsp;&nbsp;&nbsp;
				<label>
				<input type='checkbox' name="total_strong_yn" id="total_strong_yn" value="Y">두껍게
				</label>
			</TD>
		</TR>
		<TR>
			<TD bgcolor="#DBDBDB" class=list>&nbsp;&nbsp; 입력창</TD>
			<TD bgcolor="#FFFFFF" class=list>&nbsp;&nbsp; 
				배경색상
				<input type='text' name="input_color" id="input_color" value="#ffffff"  class="colorwell"
				size="10" ></TD>
		</TR>
		<TR>
			<TD bgcolor="#DBDBDB" class=list>&nbsp;&nbsp; sms 문자발송</TD>
			<TD bgcolor="#FFFFFF" class=list>&nbsp;&nbsp; 
				<label>
				<input type="checkbox" name="sms_yn" id="sms_yn" value="Y" >예
				</label>
			</TD>
		</TR>
	</TABLE>
</FORM>
</div>
<BR>
<BR>

<br/>
<div id="picker" style="display:none;position: absolute;"></div>
